{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf250
{\fonttbl\f0\fmodern\fcharset0 Courier;\f1\froman\fcharset0 Times-Roman;\f2\fnil\fcharset0 Monaco;
}
{\colortbl;\red255\green255\blue255;\red109\green109\blue109;\red234\green234\blue234;\red0\green0\blue120;
\red36\green126\blue159;}
\deftab720
\pard\pardeftab720\ql\qnatural

\f0\fs24 \cf0 NSDateFormatter *formatter = [[NSDateFormatter alloc] init];\
[formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; //this is the sqlite's format\
\
	NSData* aData;\
	aData = [aStr dataUsingEncoding: NSASCIIStringEncoding];\
\
\
NSData *dataForImage = UIImagePNGRepresentation(cachedImage);\
sqlite3_bind_blob(yourSavingSQLStatement, 2, [dataForImage bytes], [dataForImage length], SQLITE_TRANSIENT);\
\
\pard\pardeftab720\ql\qnatural

\f1 \cf0 To retrieve this image, you can use the following:
\f0 \
NSData *dataForCachedImage = [[NSData alloc] initWithBytes:sqlite3_column_blob(yourLoadingSQLStatement, 2) length: sqlite3_column_bytes(yourLoadingSQLStatement, 2)]; \'a0 \'a0 \'a0 \'a0 \'a0 \
self.cachedImage = [UIImage imageWithData:dataForCachedImage];\
[dataForCachedImage release];\
\
\pard\pardeftab720\sl360\ql\qnatural

\f2\fs28 \cf2 \cb3 // Invoked after the application has been launched and initialized but before it has received its first event.\cf0 \
- (\cf4 void\cf0 )applicationDidFinishLaunching:(\cf5 UIApplication\cf0  *)application \{\
\'a0 \'a0 \cf2 // Set up the level view controller\cf0 \
\'a0 \'a0 levelViewController = [[\cf5 LevelViewController\cf0  alloc] init];\
\'a0 \'a0 [window addSubview:levelViewController.view];\
\
\'a0 \'a0 \cf2 // Restore calibration for device\cf0 \
\'a0 \'a0 \cf4 float\cf0  restoredOffset = [[\cf5 NSUserDefaults\cf0  standardUserDefaults] floatForKey:\cf5 BubbleLevelCalibrationOffsetKey\cf0 ];\
\'a0 \'a0 levelViewController.calibrationOffset = restoredOffset;\
\}\
\
\
\cf2 // Invoked immediately before the application terminates.\cf0 \
- (\cf4 void\cf0 )applicationWillTerminate:(\cf5 UIApplication\cf0  *)application \{\
\'a0 \'a0 \cf4 float\cf0  calibrationOffset = levelViewController.calibrationOffset;\
\'a0 \'a0 \cf5 NSNumber\cf0  *offset = [\cf5 NSNumber\cf0  numberWithFloat:calibrationOffset];\
\'a0 \'a0 [[\cf5 NSUserDefaults\cf0  standardUserDefaults] setObject:offset forKey:\cf5 BubbleLevelCalibrationOffsetKey\cf0 ];\
\}}